package ntrees.hu.pxinput;

import 	java.lang.Math;

import android.util.Log;


public class CycleLine extends Line {

	private float r;
	private Position p;
	private float startRadian = 0f, endRadian = 360.0f;
	CycleLine(float r, Position p) {
		this.r = r;
		this.p = p;
	}
	
	public void setRadian(float startRadian, float endRadian) {
		this.startRadian = startRadian;
		this.endRadian = endRadian;
	}
	
	@Override
	public float length() {
		return (float) (2 * Math.PI * r * (endRadian - startRadian) / 360.0f);
	}

	@Override
	public Position getPosition(float off) {
		Log.d("------->  ", "off: " + off);
		float radian = (float) (((float)360 * off)/ (2 * Math.PI * r));
		Log.d("------->  ", "radian: " + radian);
		Position pos = new Position();
//		pos.x = p.x - Math.sin(Math.toRadians(radian))*r;
//		pos.y = p.y - Math.cos(Math.toRadians(radian))*r;
		Log.d("------->  ", "pos: " + pos);
		return pos;
	}
}
